/*
 * Copyright (c) 2010 Vadim Zhukov <persgray@gmail.com>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef OW_RESOLVER_H
#define OW_RESOLVER_H

#define DEF_PEER_DNS_PREFIX	"_overwatch._tcp."

enum {
	SASPEC_HOST_REQUIRED	= 0x01,	/* fail if host part was not found */
	SASPEC_HOST_NETWORK	= 0x02,	/* fail if address is local path */
	SASPEC_HOST_NO_DN	= 0x04,	/* fail if host part is domain name */
	SASPEC_HOST_NUMERIC	= 0x06,	/* fail if address is not IPv[46] one */
	SASPEC_FOR_BINDING	= 0x08,	/* sockaddr will be used in bind(2) */
};

SLIST_HEAD(bindaddr_list, bindaddr);
struct bindaddr {
	SLIST_ENTRY(bindaddr) entry;
	struct	sockaddr_storage	ss;
	socklen_t			slen;
	int				fd;
};

struct addrinfo *find_collectors(const char *, int);
int		 fill_sa_from_user(const char *, struct bindaddr *, int,
		    const char *);

#endif /* OW_RESOLVER_H */
